package com.alibaba.druid.sql.dialect.mysql.ast.statement;

import com.alibaba.druid.sql.ast.SQLLimit;
import com.alibaba.druid.sql.ast.SQLObject;
import com.alibaba.druid.sql.ast.statement.SQLUnionQuery;
import com.alibaba.druid.sql.dialect.mysql.ast.MySqlObject;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;














public class MySqlUnionQuery
        extends SQLUnionQuery
        implements MySqlObject
{
    private SQLLimit limit;

    public SQLLimit getLimit() { return this.limit; }


    public void setLimit(SQLLimit limit) {
        if (limit != null) {
            limit.setParent((SQLObject)this);
        }
        this.limit = limit;
    }


    protected void accept0(SQLASTVisitor visitor) {
        if (visitor instanceof MySqlASTVisitor) {
            accept0((MySqlASTVisitor)visitor);
        } else {
            throw new IllegalArgumentException("not support visitor type : " + visitor.getClass().getName());
        }
    }


    public void accept0(MySqlASTVisitor visitor) {
        if (visitor.visit(this)) {
            acceptChild((SQLASTVisitor)visitor, (SQLObject)getLeft());
            acceptChild((SQLASTVisitor)visitor, (SQLObject)getRight());
            acceptChild((SQLASTVisitor)visitor, (SQLObject)getOrderBy());
            acceptChild((SQLASTVisitor)visitor, (SQLObject)getLimit());
        }
        visitor.endVisit(this);
    }
}
